#import <Cocoa/Cocoa.h>
#import "instrument_view.h"
#import "pantomime_item.h"
#import "sms_item.h"
#import "sbrush_instrument_view_updater.h"
#import "sbrush_spectral_model.h"
#import "sbrush_spectral_model_player.h"
#import "sbrush_pantomime.h"
#import "sbrush_pantomime_player.h"


@interface PantomimeController : NSWindowController {
	NSMutableArray* smsItems;
	NSMutableArray* pantomimeItems;
	IBOutlet NSView* pantomimeView;
	IBOutlet NSArrayController* smsItemsController;
	IBOutlet NSArrayController* pantomimeItemsController;
	IBOutlet NSButton* playSmsButton;
	IBOutlet NSButton* playPantomimeButton;
	NSView* pantomimeSubView;
	sbrush::InstrumentViewUpdater* _viewUpdater;
	InstrumentView* _instrumentView;
	sbrush::Instrument* _instrument;
	sbrush::SpectralModelPlayer* _spectralModelPlayer;
	sbrush::PantomimeRecorder* _pantomimeRecorder;
	sbrush::PantomimePlayer* _pantomimePlayer;
}

@property (retain) NSMutableArray* smsItems;
@property (retain) NSMutableArray* pantomimeItems;

- (id)initWithSmsArray:(NSMutableArray*)sms 
		pantomimeArray:(NSMutableArray*)pantomimes
		pantomimeView:(NSView*)view
		instrumentView:(InstrumentView*)instView
			instrument:(sbrush::Instrument*)instrument;

/* sms controls */
- (IBAction) loadSms:(id)sender;
- (sbrush::SpectralModel*) getCurrentSpectralModel;
- (IBAction) playSms:(NSButton*)sender;
- (IBAction) startPlaySms:(id)sender;
- (IBAction) stopPlaySms:(id)sender;
- (void) finishPlaySms;

/* practice */
- (IBAction) startPractice:(id)sender;
- (void) finishPractice;

- (IBAction) loadPantomime:(id)sender;

- (PantomimeItem*) getCurrentPantomimeItem;
- (sbrush::Pantomime*) getCurrentPantomime;

/* pantomime recording */
- (void) startCountdown;
- (void) countdown:(unsigned)tminus;
- (void) finishCountdown;
- (IBAction) startPantomimeRecording:(id)sender;
- (void) finishPantomimeRecording;

/* pantomime playback */
- (IBAction) pantomimePlayback:(NSButton*)sender;
- (IBAction) startPantomimePlayback:(id)sender;
- (IBAction) stopPantomimePlayback:(id)sender;
- (void) finishPantomimePlayback;

/* drawing full screen */
- (void) startInstrumentDraw;
- (void) stopInstrumentDraw;

- (void) stopAll;

@end
